import type { App } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import { useGameStore } from '@/stores/modules/game'
import { usePlayerStore } from '@/stores/modules/player'

const pinia = createPinia()

pinia.use(piniaPluginPersistedstate)

export async function setupStore(app: App<Element>) {
  app.use(pinia)
  await useGameStore().loadData()
  await usePlayerStore().loadData()
}
